package com.tanhua.dubbo.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.SoulTest.Dimensions;
import com.tanhua.domain.SoulTest.SimilarUser;
import com.tanhua.domain.SoulTest.SoulTest;
import com.tanhua.domain.SoulTest.SoulTestResult;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 钱柏羽
 * 结果封装相关sql
 */
public interface SoulTestMapper extends BaseMapper<SoulTest> {

    @Select("SELECT*FROM tb_survey_details")
    List<SoulTest> findAll();

    @Select("SELECT conclusion,cover FROM tb_conclusion_info WHERE #{reportScore} BETWEEN low AND high")
    SoulTestResult findConclusion(@Param("reportScore") String reportScore);

    @Select("SELECT _key,_value FROM tb_dimensions WHERE cid=#{scoreType}")
    List<Dimensions> findDimensions(@Param("scoreType") String scoreType);

    @Select("SELECT id,avatar FROM tb_user_soul_result WHERE cid=#{scoreType} and user_id<>#{userId} LIMIT 5")
    List<SimilarUser> findSimilarUsers(@Param("scoreType") String scoreType, @Param("userId") Long userId);

    @Select("SELECT LEVEL FROM tb_survey_details WHERE id=#{id}")
    String getFacility(@Param("id") String id);
}
